package com.hqyj.module.login.dao;

import com.hqyj.module.login.pojo.UserInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hqyj.module.login.pojo.UserInfoNew;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Repository
public interface UserInfoMapperDao extends BaseMapper<UserInfo> {


    @Select("select * from user_info where user_name=#{userName} and user_pwd=#{userPwd}")
    UserInfo login(UserInfo userInfo);


    @Insert("insert into user_info(user_name,user_pwd) values(#{userName},#{userPwd})")
    int regiestUser(UserInfo userInfo);


    @Insert("insert into email_info(email_name,email_pwd,startTime) values(#{userName},#{userPwd},#{startTime})")
    int regiestUserEmail(UserInfo userInfo);

    @Select("select * from email_info where email_name=#{userName} and email_pwd=#{userPwd}")
    UserInfo emailLogin(UserInfo userInfo);


    @Insert("update user_info set user_pwd = #{newPwd} where email = #{userName}")
    Integer updatePwd(UserInfoNew userInfoNew);

    @Select("select * from user_info where email=#{email}")
    UserInfo getEmailUser(String email);

}
